package formulation;

import parser.FormulaReader;
import es.deusto.ingenieria.is.csp.algorithms.BackTracking;

public class MainProgram {
	public static void main(String[] args) {
		for (int i = 1; i <= 8; i++) {
			System.out.println("CryptAddition Puzzle " + i);
			System.out.println("======================");
			FormulaReader additionpuzzle = new FormulaReader("data/additionpuzzle" + i + ".xml");
			boolean unsolvable = additionpuzzle.getUnsolvable();
			System.out.println("solvable: " + !additionpuzzle.getUnsolvable() + "\n");
			if (!unsolvable) {
				PbrlCryptaddition problem = new PbrlCryptaddition(additionpuzzle.getNumOperands(), additionpuzzle.getOperandMaxLength(), additionpuzzle.getOperands(), additionpuzzle.getResult());
				//System.out.println(problem.toString());
				BackTracking<Integer> backTracking = new BackTracking<Integer>();
				problem.solve(backTracking);
			}
			System.out.println("");
		}
	}
}
